from app.configs.default import Config
import datetime
from datetime import timedelta


class Standalone(Config):

    SQLALCHEMY_MYSQL_ONLINE_DATABASE_URI = 'mysql+pymysql://root:123456@localhost:3306/cg'

    IRONMAN_MYSQL_HOST = "localhost"
    IRONMAN_MYSQL_PORT = 3306
    IRONMAN_MYSQL_USER = "root"
    IRONMAN_MYSQL_PASSWORD = "123456"
    IRONMAN_MYSQL_DATABASE = "cg"

    SQLALCHEMY_BINDS = {
        'serve_engine': SQLALCHEMY_MYSQL_ONLINE_DATABASE_URI,
        # 'cg': SQLALCHEMY_CG_URI
    }

    DEBUG = False

    # APScheduler 配置
    ENABLE_KAFKA = False

    # 控制所有定时任务的开启
    SCHEDULE_SWITCH = False
    SCHEDULER_API_ENABLED = False

    # simulation 还需要设置 deamon.py 里面的具体时间节点
    SHAOJIE_SIMULATION_ENABLED = False
    GAOLU_SIMULATION_ENABLED = False
    HANFAN_SIMULATION_ENABLED = False

    INFLUXDB_HOST = '192.168.40.214'
    INFLUXDB_PORT = 8086
    INFLUXDB_USERNAME = 'admin'
    INFLUXDB_PASSWORD = 'BICI123456'
    INFLUXDB_DATABASE = 'bfbd2023'

    # 秒级别
    if GAOLU_SIMULATION_ENABLED:
        GAOLU_INTERVAL = 5
    else:
        GAOLU_INTERVAL = 3600  # 1 小时

    if SHAOJIE_SIMULATION_ENABLED:
        SHAOJIE_INTERVAL = 5
    else:
        SHAOJIE_INTERVAL = 5

    # 秒级别
    if HANFAN_SIMULATION_ENABLED:
        HANFAN_INTERVAL = 5
    else:
        HANFAN_INTERVAL = 3600  # 20分钟

    HANFAN_DUMP_DATA_INTERVAL = 1800  # 30分钟

    # cron表达式
    GAOLU_BANBIE_SCORE_BACKTRACKING = "0,8,16"
